package personal.lijun.skeleton.web.controllers;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @Auther: lijun@sstcsoft.com
 * @Date: 2019/9/17 15:38
 */
@Controller
public class DefaultController {
    @GetMapping("/default")
    public String defaultAfterLogin(HttpServletRequest request) {
        if (request.isUserInRole("ROLE_ADMIN")) {
            return "redirect:/events/";
        }
        return "redirect:/";
    }

    @GetMapping("/admin1/default")
    public String defaultAfterLogin2(HttpServletRequest request) {
        if (request.isUserInRole("ROLE_ADMIN")) {
            return "redirect:/events/";
        }
        return "redirect:/";
    }
}
